<div class="row toolbar">
  <div class="col-md-6">
    <span class="toolbar-header">
      <%= @contact.new_record? ? "#{t(:new_address)}" : "#{t(:edit)} #{t(:address)}" %> 
    </span>
  </div>
  <div class="col-md-6 text-right">
    <ul class="toolbar-nav">
      <li><% link_to simple_icon("user"), @contact %></li>
      <li>
      <%= link_to simple_icon("user"), 
        if params.has_key?(:patient_id)
			patient_path(params[:patient_id])
		else
			staff_path(params[:staff_id])
		end 
       %>
       </li>
    </ul>
  </div>
</div>

<%= form_for(@contact, url: 
	if params.has_key?(:patient_id)
		patient_contacts_path
	else
		staff_contacts_path
	end
) do |f| %>
  <% if @contact.errors.any? %>
    <div id="error_explanation">
      <h2><%= pluralize(@contact.errors.count, "error") %> prohibited this contact from being saved:</h2>

      <ul>
      <% @contact.errors.full_messages.each do |message| %>
        <li><%= message %></li>
      <% end %>
      </ul>
    </div>
  <% end %>

  <div class="form-group">
    <%= f.label :contact_type_id %><br>
    <%= collection_select(:contact, :contact_type_id, ContactType.all, :id, :label, prompt: true) %>
    <%= link_to feather_icon('circle-plus'), 
    	if params.has_key?(:patient_id)
    		new_patient_contact_type_path 
    	else
    		new_staff_contact_type_path 
    	end
    %>
  </div>
  <div class="form-group">
    <%= f.label :address %><br>
    <%= f.text_area :address %>
  </div>
  <div class="form-group">
    <%= f.label :postal_code %><br>
    <%= f.number_field :postal_code %>
  </div>
  <div class="form-group">
    <%= f.label :phone %><br>
    <%= f.text_field :phone %>
  </div>
  <div class="form-group">
    <%= f.label :fax %><br>
    <%= f.text_field :fax %>
  </div>
    <%= f.submit class: "btn btn-primary" %>
<% end %>
